package cn.com.headfree.expert.dao.impl;

import cn.com.headfree.expert.dao.IRulerDao;
import cn.com.headfree.entity.TEmpBaseInfo;
import cn.com.headfree.vo.*;
import com.gta.edu.sdk.base.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Repository("IRulerDao")
public class IRulerDaoImpl extends BaseDaoImpl<TEmpBaseInfo> implements IRulerDao {

    //履职贡献
    @Override
    public List<TalentstandardsRuleTypeLZGXVo> getTalentstandardsRuleTypeLZGXVoList() {
        StringBuilder sqlBuilder = new StringBuilder("SELECT integral_min,integral_max,value FROM t_talentstandards_rule_type_lzgx ORDER BY integral_max DESC ");
        List<String> arryList = new ArrayList<String>();
        return this.findAllBySQL(TalentstandardsRuleTypeLZGXVo.class, sqlBuilder.toString(), null, false, arryList.toArray());
    }

    //传承育人
    @Override
    public List<TalentstandardsRuleTypeCCYRVo> getTalentstandardsRuleTypeCCYRVoList() {
        StringBuilder sqlBuilder = new StringBuilder("SELECT period,period_add,value,base_value,type,element_type,element_level,element_type_name,element_level_name  FROM t_talentstandards_rule_type_ccyr ORDER BY type DESC");
        List<String> arryList = new ArrayList<String>();
        return this.findAllBySQL(TalentstandardsRuleTypeCCYRVo.class, sqlBuilder.toString(), null, false, arryList.toArray());
    }

    //个人荣誉
    @Override
    public List<TalentstandardsRuleTypeGRRYVo> getTalentstandardsRuleTypeGRRYVoList() {
        StringBuilder sqlBuilder = new StringBuilder("SELECT element_type,element_level,value,element_type_name,element_level_name FROM t_talentstandards_rule_type_grry order by element_level asc");
        List<String> arryList = new ArrayList<String>();
        return this.findAllBySQL(TalentstandardsRuleTypeGRRYVo.class, sqlBuilder.toString(), null, false, arryList.toArray());
    }

    //专业标准
    @Override
    public List<TalentstandardsRuleTypeZYBZVo> getTalentstandardsRuleTypeZYBZVoList() {
        StringBuilder sqlBuilder = new StringBuilder("SELECT element_type,element_level,value,element_type_name,element_level_name,type FROM t_talentstandards_rule_type_zybz order by element_level asc");
        List<String> arryList = new ArrayList<String>();
        return this.findAllBySQL(TalentstandardsRuleTypeZYBZVo.class, sqlBuilder.toString(), null, false, arryList.toArray());
    }

    //专业标准难度级别
    @Override
    public List<TalentstandardsRuleTypeZYBZNDJBVo> getTalentstandardsRuleTypeZYBZNDJBVoList() {
        StringBuilder sqlBuilder = new StringBuilder("SELECT element_type,element_type_name,value FROM t_talentstandards_rule_type_zybz_ndjb ORDER BY value DESC");
        List<String> arryList = new ArrayList<String>();
        return this.findAllBySQL(TalentstandardsRuleTypeZYBZNDJBVo.class, sqlBuilder.toString(), null, false, arryList.toArray());
    }

    //学术贡献
    @Override
    public List<TalentstandardsRuleTypeXSGXVo> getTalentstandardsRuleTypeXSGXVoList() {
        StringBuilder sqlBuilder = new StringBuilder("SELECT type,element_type,element_level,value,element_type_name,element_level_name FROM t_talentstandards_rule_type_xsgx order by type,element_level asc");
        List<String> arryList = new ArrayList<String>();
        return this.findAllBySQL(TalentstandardsRuleTypeXSGXVo.class, sqlBuilder.toString(), null, false, arryList.toArray());
    }

    //专业水平
    @Override
    public List<TalentstandardsRuleTypeZYSPVo> getTalentstandardsRuleTypeZYSPVoList() {
        StringBuilder sqlBuilder = new StringBuilder("SELECT type,element_type,element_level,value,element_type_name,element_level_name FROM t_talentstandards_rule_type_zysp order by type,element_level asc");
        List<String> arryList = new ArrayList<String>();
        return this.findAllBySQL(TalentstandardsRuleTypeZYSPVo.class, sqlBuilder.toString(), null, false, arryList.toArray());
    }

//    //规则主表
//    @Override
//    public List<TalentstandardsRuleVo> getTalentstandardsRuleVoList() {
//        StringBuilder sqlBuilder = new StringBuilder("SELECT element_type,element_level,value,element_type_name,element_level_name FROM t_talentstandards_rule_type_grry order by element_level asc");
//        List<String> arryList = new ArrayList<String>();
//        return this.findAllBySQL(TalentstandardsRuleVo.class, sqlBuilder.toString(), null, false, arryList.toArray());
//    }
//
    //规则分类明细表
    @Override
    public TalentstandardsRuleTypeVo getTalentstandardsRuleTypeVoList(String type) {
        StringBuilder sqlBuilder = new StringBuilder("SELECT integral_min,integral_max,entry_min,entry_max FROM t_talentstandards_rule_type where 1=1   ");
        List<String> arryList = new ArrayList<String>();
        sqlBuilder.append(" and type= ? ");
        arryList.add(type);
        return this.findUnique(TalentstandardsRuleTypeVo.class, sqlBuilder.toString(),  arryList.toArray());
    }
}
